package com.hx.controll;


import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.hx.pojo.User;
import com.hx.service.UserService;

@Controller
public class Login {
	@Autowired
	private UserService us;
	
	@RequestMapping("loginServelt")   //关系映射
	@ResponseBody		//将数据转为JOSN数据提交
	public Result isLogin(User user,HttpServletRequest r){
		Result rs=new Result();
		if(us.findUser(user)){
			r.getSession().setAttribute("islogin",true);
			rs.setFlag(true);
		}else{
			rs.setFlag(false);
		}		
		return rs;
	}
	}

class Result{
	private boolean flag;
	public boolean isFlag(){
		return flag;
	}
	public void setFlag(boolean f){
		this.flag=f;
	}
}